package router

import (
	"ginchat/service"

	"github.com/gin-gonic/gin"
)

// Router 路由
func Router() *gin.Engine {
	app := gin.Default()
	app.GET("/index", service.GetIndex)

	app.GET("/users", service.GetUserList)
	app.GET("/user/:id", service.GetUser)
	app.POST("/user", service.CreateUser)
	app.DELETE("/user/:id", service.DeleteUser)
	app.PUT("/user/:id", service.UpdateUser)
	app.GET("/user/me", service.UserMe)

	app.POST("/login", service.UserLogin)
	app.GET("/ws", service.SendMsg)
	app.GET("/chat", service.Chat)
	return app
}
